package com.yanlight.app.service;

import com.aliyun.oss.OSSClient;
import com.yanlight.support.AliConstants;

import java.io.InputStream;

public class AliOssService {

    public static String fileupload(InputStream inputStream, String fileName) {
        OSSClient ossClient = new OSSClient(AliConstants.ossHost, AliConstants.ossKey, AliConstants.ossKeySecret);
        ossClient.putObject(AliConstants.bucketName, AliConstants.ossImagePath + fileName, inputStream);
        ossClient.shutdown();

        return AliConstants.imagePath + fileName;
    }

}
